home *** CD-ROM | disk | FTP | other *** search
- ===========================================================================
- BBS: The Abacus * HST/DS * Potterville MI
- Date: 06-13-93 (12:20) Number: 138
- From: DAVID NUGENT Refer#: NONE
- To: ALL Recvd: NO
- Subj: [07 of 12] Mystream.h Conf: (37) C++ Langua
- ---------------------------------------------------------------------------
- // Mystream.h
- // iostream interface for class Myio
- // Defines the following classes:
- // Mystreambuf derived from streambuf - buffer management & I/O interface
- // Mystreambase base class used for initialisation & object reference
- // Myiostream customised iostream, derived from iostream/Mystreambase
- //
- // Written by David L Nugent, June 1993
- //
-
- # if !defined(_Mystream_h)
- # define _Mystream_h 1
- # include <iostream.h>
- # include "Myio.h"
-
- //
- // Mystreambuf
- // This is the class which does all the actual I/O
- // handling and (optional) buffer management
- //
-
- class Mystreambuf : public streambuf
- {
-
- public:
-
- Mystreambuf (Myio * mPtr);
-
- protected:
-
- virtual int overflow (int = EOF);
- virtual int underflow ();
- virtual int sync ();
-
- private:
-
- Myio * mptr; // Points to the Myio instance to
- // which this stream is attached
- char _back[2]; // Holder for putback
-
- };
-
-
- class Mystreambase : public virtual ios
- {
-
- public:
-
- Mystreambase (Myio * mPtr);
- Mystreambuf * rdbuf (void);
-
- protected:
-
- Mystreambuf mystreambuf;
-
- };
-
- inline
- Mystreambase::Mystreambase (Myio * mPtr)
- : mystreambuf (mPtr)
- {}
-
- inline Mystreambuf *
- Mystreambase::rdbuf (void)
- { return &mystreambuf; }
-
-
- class Mystream : public Mystreambase, public iostream
- {
-
- public:
-
- Mystream (Myio * mPtr);
- ~Mystream (void);
- };
-
- //
- // class Mystream constructor
- // This uses Mystreambase to set up the Mystreambuf
- // which can then be used to initialise iostream.
- //
-
- inline
- Mystream::Mystream (Myio * m)
- : Mystreambase (m), iostream (rdbuf())
- {}
-
- inline
- Mystream::~Mystream (void)
- {}
-
- # endif // _Mystream_h
-
- --- MaltEd 1.0.b5
- * Origin: Unique Computing Pty Ltd (3:632/348)
- SEEN-BY: 1/211 11/2 4 13/13 101/1 109/25 114/5 123/19 124/1 153/752 154/40
- SEEN-BY: 154/77 157/110 159/100 125 140 180 270 430 575 950 203/23 209/209
- SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2430/1 2440/5 3603/20
-